package cn.nubia.admin.sysconfig.bean;

import cn.nubia.admin.common.mybatis.annotations.Id;
import cn.nubia.admin.common.mybatis.annotations.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by Jason on 2015/6/27.
 */
@Table(value = "t_menu_res")
public class MenuResource implements Serializable{

    /**
     * id.
     */
    @Id
    private Integer id;


    /**
     * 父节点id
     */
    private Integer pid;

    /**
     * 资源名称
     */
    private String name;

    /**
     * 排序
     */
    private int sort;

    /**
     * 备注
     */
    private String remark;

    /**
     * 权限类型 默认：菜单0 资源权限：1
     */
    private int type;

    /**
     * url
     */
    private String url;

    /**
     * 资源目标
     */
    private String target;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     *权限名
     */
    private String permission;

    /**
     * 是否可用.
     */
    private int enable;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSort() {
        return sort;
    }

    public void setSort(int sort) {
        this.sort = sort;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getTarget() {
        return target;
    }

    public void setTarget(String target) {
        this.target = target;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public int getEnable() {
        return enable;
    }

    public void setEnable(int enable) {
        this.enable = enable;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        MenuResource that = (MenuResource) o;

        return new EqualsBuilder()
                .append(permission, that.permission)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(permission)
                .toHashCode();
    }
}
